﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace _1Dot9MasterData
{
    public class TypeAlias
    {
        public static DbType GetDbType(Type dbCode)
        {
            TypeCode tCode = (TypeCode)Type.GetTypeCode(dbCode);
            switch (tCode)
            {
                case TypeCode.Char:
                case TypeCode.String:
                    return DbType.String;
                case TypeCode.Int16:
                    return DbType.Int16;
                case TypeCode.Int32:
                    return DbType.Int32;
                case TypeCode.Int64:
                    return DbType.Int64;
                case TypeCode.DateTime:
                    return DbType.DateTime;
                case TypeCode.Boolean:
                    return DbType.Boolean;
                case TypeCode.Byte:
                    return DbType.Byte;
            }
            return DbType.String;
        }
    }
}
